home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
BARNET
/
COMPILER
/
SATHER
/
!Sather
/
Library
/
Containrs
/
Contrs.sam
next >
Wrap
Text File
|
1997-03-08
|
7KB
|
157 lines
---------------------------------------------------------------
-- THIS FILE HAS BEEN CREATED FROM
-- --> Library/Containers/Containers.module.pp <--
-- DO NOT MODIFY IT
---------------------------------------------------------------
-- Copyright (C) International Computer Science Institute, 1994. COPYRIGHT --
-- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject --
-- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in --
-- the file "Doc/License" of the Sather distribution. The license is also --
-- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA. --
--------> Please email comments to "sather-bugs@icsi.berkeley.edu". <----------
(*
CONTAINER CLASSES
These data types can hold other objects. They are all built up
out of more primitive Sather classes in Base.
The most important of these is ARRAY. It extends the built-in array
providing class AREF and provides facilities for sorting, printing,
interating, and so forth. The Sather language also allows a special
array-constructing literal syntax:
| a, b, c |
ARRAY2 and ARRAY3 provide multiple dimensions and are built using AREF
with multiplicative indexing.
The TUP classes make it convenient to construct tuples of other types.
The TUP classes are value classes, so they are efficient; there is no
heap management involved in their implementation. Because of Sathers
type inference, their construction can usually be acheived with:
#(first, second)
The TUP classes "do the right thing" automatically with respect to
equality and hash values.
There are three types of container classes
- abstract interfaces (such as $RO_SET{T} and $SET{T})
- concrete implementations (such as H_SET, LH_SET and SET)
- algorithm classes (collections of stateless algorithm functions)
Finally, we have the high-performance workhorse Sather classes,
FLIST, FMAP, FSET and FQSET which use amortised doubling. The "F"
prefix denotes fast. They have slightly awkward interfaces requiring
writebacks, i.e.
myset := myset.insert(foo);
Although this appears to be a value-oriented interface, the 'myset'
returned may actually be the same as the 'myset' on the right side (in
fact, it usually will be.) This is done for absolute speed (the 'F'
stands for 'fast'.) We suggest that they be avoided by novices and
should certainly not be used in class interfaces (i.e. their use
should be intra-class).
*)
-- Container Hierarchy
container.sa -has container.sa $CONTAINER -- Container abstraction
dispenser.sa -has dispenser.sa $DISPENSER -- Dispensers abstraction
-- for containers such as stacks
arr.sa -has arr.sa $ARR -has arr.sa $RO_ARR -- Array abstraction
-- Algorithm modules
member.sa -has member.sa MEMBER -- Membership funcs on a container
a_alg.sa -has a_alg.sa A_ALG -- Miscellaneous array algs
a_permute.sa -has a_permute.sa A_PERMUTE -- Permutations of arrays
a_sort.sa -has a_sort.sa A_SORT -- Sorting arrays
a_select.sa -has a_select.sa A_SELECT -- Selecting ith elt
a_search.sa -has a_search.sa A_SEARCH -- Binary searching.
-- Basic container classes ARRAY, TUP and NEXT
array.sa -has array.sa ARRAY
array2.sa -has array2.sa ARRAY2
array3.sa -has array3.sa ARRAY3
tup.sa -has tup.sa TUP
next.sa -has next.sa $NEXT NEXT
-- Standard container classes
list.sa -has list.sa $LIST -- Extensible arrays
a_list.sa -has a_list.sa A_LIST LIST
queue.sa -has queue.sa $QUEUE
a_queue.sa -has a_queue.sa A_QUEUE QUEUE
stack.sa -has stack.sa $STACK
nr_stack.sa -has nr_stack.sa $NR_STACK
a_stack.sa -has a_stack.sa A_STACK STACK
nr_a_stack.sa -has nr_a_stack.sa NR_A_STACK STACK
pq.sa -has pq.sa $PQ -- Priority queue
a_pq.sa -has a_pq.sa A_PQ PQMIN PQWT PQMINWT
bag.sa -has bag.sa $RO_BAG $BAG
bag_incl.sa -has bag_incl.sa BAG_INCL
h_bag.sa -has h_bag.sa H_BAG BAG
map.sa -has map.sa $RO_MAP $MAP
map_incl.sa -has map_incl.sa MAP_INCL MAP
h_map.sa -has h_map.sa H_MAP
multimap.sa -has multimap.sa $RO_MULTIMAP $MULTIMAP -- Multi-maps
multi_incl.sa -has multi_incl.sa RO_MULTIMAP_INCL MULTIMAP_INCL MULTIMAP
h_multimap.sa -has h_multimap.sa H_MULTIMAP -- Hash multi-map
set.sa -has set.sa $RO_SET $SET
set_incl.sa -has set_incl.sa RO_SET_INCL SET_INCL BINOP_SET_VIEW
h_set.sa -has h_set.sa SET H_SET -- Hash set
set_views.sa -has set_views.sa FILTER_SET_VIEW -- Filtered view of a set
llist.sa -has llist.sa LLIST LL_NODE -- Linked list class,
-- no abstraction as yet
btree.sa -has btree.sa B_TREE BT_NODE BT_NELEM
-- (a,b)-Trees
-- Fast workhorse container classes, to be used with care.
-- Try to only use locally within a routine or class - avoid
-- using them in interfaces. Many of these have no single abstraction
-- and contain all kinds of routines that may be useful in different
-- circumstances.
flist.sa -has flist.sa FLIST
fmap.sa -has fmap.sa FMAP
fset.sa -has fset.sa FSET -- Representation switching version of FSET
orig_fset.sa -has orig_fset.sa ORIG_FSET -- Original FSET
fqset.sa -has fqset.sa FQSET
fmultimap.sa -has fmultimap.sa FMULTIMAP
fgap_list.sa -has fgap_list.sa FGAP_LIST
-- Implementation classes
hashtab.sa -has hashtab.sa DYNAMIC_BUCKET_TABLE DYNAMIC_DATABUCKET_TABLE
BUCKET DATABUCKET
-- Test classes
test/tup.sa -has test/tup.sa TEST_TUP
test/array2.sa -has test/array2.sa TEST_ARRAY2
test/array3.sa -has test/array3.sa TEST_ARRAY3
test/arrays.sa -has test/arrays.sa TEST_ARR_ALG TEST_SORT
TEST_ARRAY TEST_LIST
test/flist.sa -has test/flist.sa TEST_FLIST
test/fset.sa -has test/fset.sa TEST_FSET
test/orig_fset.sa -has test/orig_fset.sa TEST_ORIG_FSET
test/fmap.sa -has test/fmap.sa TEST_FMAP
test/fmultimap.sa -has test/fmultimap.sa TEST_FMULTIMAP
test/fgap_list.sa -has test/fgap_list.sa TEST_FGAP_LIST
test/queue.sa -has test/queue.sa TEST_QUEUE
test/stack.sa -has test/stack.sa TEST_STACK
test/pq.sa -has test/pq.sa TEST_PQ
test/set.sa -has test/set.sa TEST_SET
test/map.sa -has test/map.sa TEST_MAP
test/bag.sa -has test/bag.sa TEST_BAG
test/multimap.sa -has test/multimap.sa TEST_MULTIMAP
test/llist.sa -has test/llist.sa TEST_LLIST -- Linked list test
test/btree.sa -has test/btree.sa TEST_BTREE BT_NODE_DBG B_TREE_DBG